package com.bluesky.controller;


import com.bluesky.comm.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/lesson009")
@Slf4j
public class Lesson009Controller {

    /**
     * 获取所有的线程池信息
     * @return
     */
    @GetMapping("/threadPoolInfoList")
    public Result<List<ThreadPoolInfo>> threadPoolInfoList() {
        return ResultUtils.success(ThreadPoolManager.threadPoolInfoList());
    }

    /**
     *
     * @param threadPoolChange
     * @return
     */
    @PostMapping("/threadPoolChange")
    public Result<Boolean> threadPoolChange(@RequestBody ThreadPoolChange threadPoolChange) {
        ThreadPoolManager.changeThreadPool(threadPoolChange);
        return ResultUtils.success(true);
    }
}
